doctype html
html(lang='en', data-ng-app='angular-client-side-auth')
    head
        meta(charset='utf-8')
        base(href='/')
        title Angular Auth Example
        link(rel='stylesheet', href='/css/app.css')
        link(href="/components/bootstrap/dist/css/bootstrap.min.css", rel="stylesheet")
        link(href="/components/font-awesome/css/font-awesome.min.css", rel="stylesheet")

        // This is needed because Facebook login redirects add #_=_ at the end of the URL
        script(type="text/javascript").
            if (window.location.href.indexOf('#_=_') > 0) {
                window.location = window.location.href.replace(/#.*/, '');
            }
    body(data-ng-cloak)

        .navbar(data-ng-controller="NavCtrl")
            .navbar-inner
                .container-fluid
                    ul.nav.nav-tabs
                        li(data-access-level='accessLevels.anon', active-nav)
                            a(href='/login') Log in
                        li(data-access-level='accessLevels.anon', active-nav)
                            a(href='/register') Register
                        li(data-access-level='accessLevels.user', active-nav)
                            a(href='/') Home
                        li(data-access-level='accessLevels.user', active-nav='nestedTop')
                            a(href='/private') Private
                        li(data-access-level='accessLevels.admin', active-nav)
                            a(href='/admin') Admin
                        li(data-access-level='accessLevels.user')
                            a(href="", data-ng-click="logout()")
                                | Log out
                        div#userInfo.pull-right(data-access-level='accessLevels.user')
                            | Welcome&nbsp;
                            strong {{ user.username }}&nbsp;
                            span.label(data-ng-class='{"label-info": user.role.title == userRoles.user.title, "label-success": user.role.title == userRoles.admin.title}') {{ user.role.title }}

        .container(data-ui-view)
        #alertBox.alert.alert-danger(data-ng-show="error")
            button(type="button", class="close", data-ng-click="error = null;") &times;
            strong Oh no!&nbsp;
            span(data-ng-bind="error")

        script(src='/components/angular/angular.min.js')
        script(src='/components/angular-cookies/angular-cookies.min.js')
        script(src='/components/angular-ui-router/release/angular-ui-router.min.js')
        script(src='/js/routingConfig.js')
        script(src='/js/app.js')
        script(src='/js/services.js')
        script(src='/js/controllers.js')
        script(src='/js/filters.js')
        script(src='/js/directives.js')

        // Partial views... Load up front to make transitions smoother
        script(type="text/ng-template", id="404")
            include partials/404
        script(type="text/ng-template", id="admin")
            include partials/admin
        script(type="text/ng-template", id="home")
            include partials/home
        script(type="text/ng-template", id="login")
            include partials/login
        script(type="text/ng-template", id="private/layout")
            include partials/private/layout
        script(type="text/ng-template", id="private/home")
            include partials/private/home
        script(type="text/ng-template", id="private/nested")
            include partials/private/nested
        script(type="text/ng-template", id="private/nestedAdmin")
            include partials/private/nestedAdmin
        script(type="text/ng-template", id="register")
            include partials/register
